<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2011 rel. 2 (http://www.altova.com) by SMALS-MVM ASBL/VZW (SMALS-MVM ASBL/VZW) --><xs:schema targetNamespace="urn:be:fgov:ehealth:chap4:core:v1" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:be:fgov:ehealth:chap4:core:v1" xmlns:core="urn:be:fgov:ehealth:commons:core:v1">
	<!--eHealth core element-->
	<xs:import namespace="urn:be:fgov:ehealth:commons:core:v1" schemaLocation="ehealth-commons-schema-core-1_4.xsd"/>
	<!-- chap4 services types -->
	<!-- Reference types-->
	<xs:simpleType name="MessageReferenceType">
		<xs:restriction base="xs:string">
			<xs:length value="14"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Num14ReferenceType">
		<xs:restriction base="xs:decimal">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="99999999999999"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="StringReferenceType">
		<xs:restriction base="xs:string">
			<xs:maxLength value="14"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="SelfRefType" abstract="true">
		<xs:annotation>
			<xs:documentation>Elements of this base type do not require any content, instead it is also possible to refer to another element with the same type and same name. The referencee should specify and id, and the referencer should specify a ref-attribute.</xs:documentation>
		</xs:annotation>
		<xs:attribute name="Id" type="xs:ID">
			<xs:annotation>
				<xs:documentation>The ID of an element.  Can be used by other elements with the same name and type to reference this element.  An ID should only be unique inside a document, in this case the SOAP message. In other words, each request can reuse the same ID values.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
		<xs:attribute name="Ref" type="xs:anyURI">
			<xs:annotation>
				<xs:documentation> A XPoiter reference to another element with the same name and type. When this is present, the content of the element should be empty. MyCareNet will substitute the this element by the element it references. The XPointer should result in a single element with the same type the this element. See ValueRefString type for more information about XPointer.</xs:documentation>
			</xs:annotation>
		</xs:attribute>
	</xs:complexType>
	<xs:complexType name="ValueRefString">
		<xs:annotation>
			<xs:documentation>Elements of this type do not require any content, instead it is also possible to refer to another element in the same document with the same values. The referencee should specify and id, and the referencer should specify a ref-attribute.</xs:documentation>
		</xs:annotation>
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="ValueRef" type="xs:anyURI">
					<xs:annotation>
						<xs:documentation>A XPoiter reference to another element with the same type. When this is present, the content of the element should be empty.  MyCareNet will substitute the content of this element by the result of the XPointer. The XPointer should result in a node-set that is compliant with the type of this element. XPointer is a W3C standard that is commonly used to reference other elements.  This is for example used by the XMLDSig standard, although it only requires a sub-section to be implemented. See service catalogue for more information.</xs:documentation>
					</xs:annotation>
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<!-- Common output -->
	<xs:complexType name="CommonOutputType">
		<xs:annotation>
			<xs:documentation>The "root"-type of the common output element.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="InputReference" type="StringReferenceType" minOccurs="0"/>
			<xs:element name="NIPReference" type="StringReferenceType" minOccurs="0"/>
			<xs:element name="OutputReference" type="StringReferenceType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="RecordCommonOutputType">
		<xs:sequence>
            <xs:element name="InputReference" type="Num14ReferenceType" minOccurs="0"/>
            <xs:element name="OutputReference" type="Num14ReferenceType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<!-- Common input -->
	<xs:complexType name="CommonInputType">
		<xs:annotation>
			<xs:documentation>The "root"-type of the common input element.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Request" type="RequestType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>Generic information about the request itself.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Origin" type="OriginType">
				<xs:annotation>
					<xs:documentation>Common input about the origin of the request.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="InputReference" type="StringReferenceType" minOccurs="0"/>
			<xs:element name="NIPReference" type="StringReferenceType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="RecordCommonInputType">
		<xs:sequence>
			<xs:element name="InputReference" type="Num14ReferenceType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="RequestType">
		<xs:annotation>
			<xs:documentation>Information about the request.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="IsTest" type="xs:boolean">
				<xs:annotation>
					<xs:documentation>Indicates if the message is a test message or not.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="OriginType">
		<xs:annotation>
			<xs:documentation>Information about the originator of the request.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Package" type="PackageType">
				<xs:annotation>
					<xs:documentation>The package that the originator used to send the request.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="CareProvider" type="CareProviderType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The care provider for which the request was sent. This is not necessary the party that sent the request, but it can be.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="PackageType">
		<xs:annotation>
			<xs:documentation>Information about the software package that is connectedto MyCareNet.</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractIdType">
				<xs:sequence>
					<xs:element name="License" type="LicenseType">
						<xs:annotation>
							<xs:documentation>Each software package provider receives a license when he is granted access to MyCareNet. The package must provide this license in this element.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="LicenseType">
		<xs:annotation>
			<xs:documentation>Information about the license of a package.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Username" type="xs:string">
				<xs:annotation>
					<xs:documentation>The user name of the license. This is a unique identifier of the package.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Password" type="xs:string">
				<xs:annotation>
					<xs:documentation>The password of the license. This is required to prove the identify of the package.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="CareProviderType">
		<xs:annotation>
			<xs:documentation>Information about a care provider. This is a person or institution that provides health care service to persons.</xs:documentation>
		</xs:annotation>
		<xs:sequence>
			<xs:element name="Nihii" type="NihiiType">
				<xs:annotation>
					<xs:documentation>The NIHII (FR:INAMI, NL:RIZIV) number of the care provider. This is always required.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="PhysicalPerson" type="IdType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The physical person that is linked to the NIHII number provided. Should only be provided when the NIHII is linked a person. See service catalogue for more details.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Organization" type="IdType" minOccurs="0">
				<xs:annotation>
					<xs:documentation>The organization that is linked to the NIHII number provided. Should only be provided when the NIHII is linked an organization. See service catalogue for more details.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="AbstractIdType" abstract="true">
		<xs:annotation>
			<xs:documentation>Everything that is an entity derives from this type. Enties are object that are distinguishable and have a name. This name isn't nesesary unique.</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="SelfRefType">
				<xs:sequence>
					<xs:element name="Name" type="ValueRefString" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Optional name of entity. If provided it is used in a pure informal way. It will be added to certain logs and might appear on some representations.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="IdType">
		<xs:annotation>
			<xs:documentation>Enities that have a unique identification have this type. This identification is always issued by an authority. Only one of the child elements is required, the others are prohibited. In other words, this is actualy a xsd-choise, but this does not always translate so well in code. Therefore we decided to make it an sequence with all optional elements.</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="AbstractIdType">
				<xs:sequence>
					<xs:element name="Nihii" type="NihiiType" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Identification issued by the NIHII. It uniquely specifies a care provider in his role.</xs:documentation>
						</xs:annotation>
					</xs:element>
					<xs:element name="Ssin" type="ValueRefString" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Identification issued by the National Registry of Belgium. It uniquely specifies a physical person.</xs:documentation>
						</xs:annotation>
					</xs:element>
					<xs:element name="Cbe" type="ValueRefString" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Identification issued by the CBE. It uniquely specifies an enterprise.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="NihiiType">
		<xs:annotation>
			<xs:documentation>The NIHII number with its meta-data.</xs:documentation>
		</xs:annotation>
		<xs:complexContent>
			<xs:extension base="SelfRefType">
				<xs:sequence>
					<xs:element name="Quality" type="xs:string" minOccurs="0">
						<xs:annotation>
							<xs:documentation>Meta-data that indicates to which type of care provider the NIHII number was assigned too. This element is required and can only be obmitted when the parent element references another element.</xs:documentation>
						</xs:annotation>
					</xs:element>
					<xs:element name="Value" type="ValueRefString" minOccurs="0">
						<xs:annotation>
							<xs:documentation>The NIHII number itself. This element is required and can only be obmitted when the parent element references another element.</xs:documentation>
						</xs:annotation>
					</xs:element>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<!-- Core elements -->
	<xs:complexType name="CareReceiverIdType">
		<xs:sequence>
			<xs:element name="Ssin" type="core:SsinType" minOccurs="0"/>
			<xs:element name="RegNrWithMut" type="RegNrWithMutType" minOccurs="0"/>
			<xs:element name="Mutuality" type="MutualityType" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:simpleType name="MutualityType">
		<xs:restriction base="xs:string">
			<xs:length value="3"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="RegNrWithMutType">
		<xs:restriction base="xs:string">
			<xs:maxLength value="13"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="SecuredContentType">
		<xs:sequence>
			<xs:element name="SecuredContent" type="xs:base64Binary"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="FaultType">
		<xs:sequence>
			<xs:element name="FaultCode" type="xs:string"/>
			<xs:element name="FaultSource" type="xs:string">
				<xs:annotation>
					<xs:documentation xml:lang="en">Contains the name of the subsystem that caused the error event to occur.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Message" type="core:LocalisedString">
				<xs:annotation>
					<xs:documentation xml:lang="en">A human-readable error message.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Detail" type="DetailType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="DetailType">
		<xs:sequence>
			<xs:element name="DetailCode" type="xs:string">
				<xs:annotation>
					<xs:documentation xml:lang="en">Contains a detail code.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="DetailSource" type="xs:string"/>
			<xs:element name="Location" type="xs:string" minOccurs="0">
				<xs:annotation>
					<xs:documentation xml:lang="en">Contains the location of the fault. This could be an XPath expression.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="Message" type="core:LocalisedString" minOccurs="0">
				<xs:annotation>
					<xs:documentation xml:lang="en">Contains a human-readable message.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>